//package com.itisyue.fun.controller;
//
//import io.micrometer.core.instrument.Counter;
//import io.micrometer.core.instrument.MeterRegistry;
//import io.micrometer.core.instrument.Tags;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.PostConstruct;
//
//@RestController
//@RequestMapping("/gateway/metrics")
//public class GrafanaTestController {
//    @Autowired
//    private MeterRegistry meterRegistry;
//    private Counter counterOrder;
//    private Counter counterProduct;
//
//    @PostConstruct
//    public void init() {
//        Tags tags = Tags.of("common", "test");
//        // 公共标签
//        meterRegistry.config().commonTags(tags);
//        counterOrder = Counter.builder("metrics.request.order").register(meterRegistry);
//        counterProduct = Counter.builder("metrics.request.product").register(meterRegistry);
//    }
//
//    /**
//     * 订单请求测试
//     */
//    @GetMapping("/order/{appId}")
//    public String orderTest(@PathVariable("appId") String appId) {
//        counterOrder.increment();
//        return appId;
//    }
//
//    /**
//     * 产品请求测试
//     */
//    @GetMapping("/product/{appId}")
//    public String productTest(@PathVariable("appId") String appId) {
//        counterProduct.increment();
//        return appId;
//    }
//}
